package com.hadoop.mr2.combinersmallfile;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class CombineSmallfile {
	
	
	public static void main(String[] args) {
		try {
			Configuration conf = new Configuration();
			Job job = Job.getInstance(conf);
			job.setJarByClass(CombineSmallfile.class);
			job.setMapperClass(CombineSmallfileMapper.class);
			
			job.setMapOutputKeyClass(Text.class);
			job.setMapOutputValueClass(BytesWritable.class);
			
			job.setInputFormatClass(CombineSmallfileInputFormat.class);
			FileInputFormat.setInputPaths(job, new Path("hdfs://192.168.186.6:9000/combinerSmallfile"));
			FileOutputFormat.setOutputPath(job, new Path("hdfs://192.168.186.6:9000/combinerSmallfile/result"));
			job.waitForCompletion(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
